import Vue from 'vue'
import VueRouter from 'vue-router'

import homeView from '../views/homeView.vue'
import friendView from '../views/friendView.vue'
import login from '../views/loginView.vue'
import AboutView from '@/views/AboutView.vue'
import RoomsView from '@/views/RoomsView.vue'
import accessRoom from '@/views/LiaoView.vue'
import GeRen from '@/views/GeRen.vue'
import CreateRoomView from '@/views/createRoomView.vue'

Vue.use(VueRouter)
const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: login },
  { path: '/he', name: 'he', component: AboutView },
  {
    path: '/home',
    name: 'home',
    component: homeView,
    children: [
      {
        path: '/',
        component: friendView
      },
      {
        path: '/rooms',
        component: RoomsView
      },
      {
        path: '/myMsg',
        component: GeRen
      }
    ]
  },
  {
    path: '/accroom',
    name: 'accroom',
    component: accessRoom
  },
  {
    path: '/createRoom',
    component: CreateRoomView
  }
]

const router = new VueRouter({
  mode: 'hash', // 去掉url中的#
  routes
})
export default router
